import { Component } from "react";
// redux 数据监听
import { connect } from "react-redux";
import "./loading.scss";
import logo from "../../../logo.svg"; //图片

class loading extends Component {
  constructor(props) {
    super(props);

    this.state = {
      loading: false,
    };
  }
  render() {
    console.log(this.props, "==============props88888");
    return (
      <div
        className="loading"
        style={{ display: this.props.loading ? "block" : "none" }}
      >
        <img src={logo} className="App-logo" alt="logo" />
      </div>
    );
  }
}
// 将数据插入 state中 data 初始化数据 props一样 (初始化 可以在props 使用)
const mapStateToProps = (state) => {
  console.log(state, "====***999");
  return {
    // number: state.number //单个数据
    loading: state.loading.loading, //多个数据
  };
};

export default connect(mapStateToProps)(loading);
